#include "ET++.ph"
#ifdef __GNUG__
#pragma implementation
#endif

#include "Look.h"

#include "Port.h"

Look *gLook;

static Look *looks[5];
static int lookcnt;
static int currentlook;

//---- Look --------------------------------------------------------------------

Look::Look()
{
	/* looks[lookcnt++]= this; */
	backgroundColor= gInkWhite;
	disableInk= ePatGrey50;
	popUpMenuLayout= menuLineLayout= 0;
}

Look::~Look()
{
	SafeDelete(popUpMenuLayout);
	SafeDelete(pullDownMenuLayout);
	SafeDelete(menuLineLayout);
	SafeDelete(menuItemLayout);
	SafeDelete(scrollButtonLayout);
	SafeDelete(radioButtonLayout);
	SafeDelete(toggleButtonLayout);
	SafeDelete(scrollBarLayout);
	SafeDelete(actionButtonLayout);
	SafeDelete(defaultButtonLayout);
	SafeDelete(popupButtonLayout);
	SafeDelete(sliderLayout);
	SafeDelete(thumbLayout);
	SafeDelete(fieldBorderLayout);
	SafeDelete(fieldLayout);
	SafeDelete(menuBarLayout);
	SafeDelete(sashLayout);
	SafeDelete(progressBarLayout);
	SafeDelete(scaleLayout);
	SafeDelete(scaleThumbLayout[eHor]);
	SafeDelete(scaleThumbLayout[eVert]);
	SafeDelete(groupLayout);
	SafeDelete(frameLayout);
}

void Look::DrawHighlight(Rectangle&)
{
}

extern Look *MakeEtLook();
extern Look *MakeMotifLook();

void MakeLook(bool motif)
{
	looks[lookcnt++]= MakeMotifLook();
	looks[lookcnt++]= MakeEtLook();
	currentlook= motif ? 0 : 1;
	gLook= looks[currentlook];
}

void ToggleLook()
{
	if (currentlook == lookcnt-1)
		currentlook= 0;
	else
		currentlook++;
	gLook= looks[currentlook];
}

ONEXIT(Look)
{
	for (int i= 0; i < lookcnt; i++)
		SafeDelete(looks[i]);
	lookcnt= 0;
}

